<template>
  <div></div>
</template>

<script>
import { getCurrentInstance } from "vue";
export default {
  mounted() {
    //optionsApi 全局获取$name的值
    console.log('optionsApi',this.$name);
  },

  //compositionApi
  setup() {
    const instance = getCurrentInstance()
    const name = instance.appContext.config.globalProperties.$name
    console.log('setup',name);
    return {};
  },
};
</script>

<style lang="scss" scoped>
</style>